package io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos= new FileOutputStream("bos.txt");
        BufferedOutputStream bos=new BufferedOutputStream(fos);
        //缓冲流才具有加速功能
        String line ="";
        bos.write(line.getBytes(StandardCharsets.UTF_8));
        System.out.println("");

        bos.flush();//flush（）强制写出
        bos.close();//缓冲流close（）会自动调用福禄寿（）确保所有数据关闭前写出

    }
}
